<script type="text/javascript">

/* <![CDATA[ */

	$(document).ready(function()
	{
		$("#search-toggle").toggle
		(
			function (event)
			{
				$("#advanced").slideDown("fast"); //Slide Down Effect
	       		$("#search-toggle").html("Simple search");      
			}, 
	        function (event) 
			{
				$("#advanced").slideUp("fast"); //Slide Down Effect
	       		$("#search-toggle").html("Advanced search");      

			}
		);
	});
	

/* ]]> */

</script>


<div id="top-left-padding">
<p>&nbsp;</p>
</div>

<div id="search-bar">

    <?php
	echo form_open('electoral_roll/submit_search');
	?>
	<fieldset id="search_form">
		<legend>Search</legend>
		<div>
	<?php
    echo form_hidden ("roll", $roll);
    echo '<label for="name">Name:</label>';
	echo form_input('name', $name_search);
    echo '<label for="address">Address:</label>';
	echo form_input('address', $address_search);
	//echo br();
	echo form_submit('submit', 'Search');
	echo form_close();
	?>
	<div id="search_clear">
	<?php 
	echo form_open('electoral_roll/clear_search');
    echo form_hidden ("roll", $roll);
	echo form_submit('clear', 'Clear');
	?>
	</div>
		</div>
	</fieldset>
	<?php
	echo form_close();
	?>

</div>

<div id="roll-list">
	<table>
		<thead>
			<tr>
				<th>Ward</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach ($rolls as $row) { ?>

			<tr>

				<td>
				<?php
				if ($row->id == $roll)
				{
					echo $row->display_name;
				}
				else
				{
        			echo anchor("electoral_roll/view/$row->id", $row->display_name);
				}

				?>
				</td>


			</tr>
		<?php } ?>
		</tbody>
	 </table>
</div>

<div id="elector-list">
	<table>
		<thead>
			<tr>
				<th width="10%">Reference</th>

				<th width="30%">Name</th>

                <th>Address</th>

			</tr>
		</thead>
		<tbody>

		<?php foreach ($entries as $row) { ?>

			<tr class="tr<?php echo alternator('1', '2') ?>">
				<td><?php echo $row->polling_district ?> <?php echo $row->voter_number ?><?php if ($row->voter_number_suffix != 0) {echo "/" . $row->voter_number_suffix;} ?></td>
        	    <td><?php echo anchor("person/display/$row->person/$roll", $row->surname . ", " . $row->first_names) ?></td>
				<td><?php echo $row->address1 . ", " . $row->address2 ?></td>
			</tr>
			
		<?php } ?>
	</tbody>
</table>

<div class="pagination">
	<?php echo $this->pagination->create_links(); ?>
</div>

</div>